package com.muyu.system.controller;


import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.system.domain.DanmoMarketSeal;
import com.muyu.system.service.IDanmoMarketSealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 书画市场印章Controller
 * 
 * @author kunzong
 * @date 2024-12-26
 */
@RestController
@RequestMapping("/DanmoMarketSeal")
public class DanmoMarketSealController extends BaseController
{
    @Autowired
    private IDanmoMarketSealService danmoMarketSealService;

    /**
     * 查询书画市场印章列表
     */
//    @RequiresPermissions("system:DanmoMarketSeal:list")
    @GetMapping("/list")
    public Result list(DanmoMarketSeal danmoMarketSeal)
    {
        startPage();
        List<DanmoMarketSeal> list = danmoMarketSealService.selectDanmoMarketSealList(danmoMarketSeal);
        return Result.success(list);
    }

    /**
     * 导出书画市场印章列表
     */
//    @RequiresPermissions("system:DanmoMarketSeal:export")
    @Log(title = "书画市场印章", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DanmoMarketSeal danmoMarketSeal)
    {
        List<DanmoMarketSeal> list = danmoMarketSealService.selectDanmoMarketSealList(danmoMarketSeal);
        ExcelUtil<DanmoMarketSeal> util = new ExcelUtil<DanmoMarketSeal>(DanmoMarketSeal.class);
        util.exportExcel(response, list, "书画市场印章数据");
    }

    /**
     * 获取书画市场印章详细信息
     */
//    @RequiresPermissions("system:DanmoMarketSeal:query")
    @GetMapping(value = "/{id}")
    public Result getInfo(@PathVariable("id") Long id)
    {
        return Result.success(danmoMarketSealService.selectDanmoMarketSealById(id));
    }

    /**
     * 新增书画市场印章
     */
//    @RequiresPermissions("system:DanmoMarketSeal:add")
    @Log(title = "书画市场印章", businessType = BusinessType.INSERT)
    @PostMapping
    public Result add(@RequestBody DanmoMarketSeal danmoMarketSeal)
    {
        return Result.success(danmoMarketSealService.insertDanmoMarketSeal(danmoMarketSeal));
    }

    /**
     * 修改书画市场印章
     */
//    @RequiresPermissions("system:DanmoMarketSeal:edit")
    @Log(title = "书画市场印章", businessType = BusinessType.UPDATE)
    @PutMapping
    public Result edit(@RequestBody DanmoMarketSeal danmoMarketSeal)
    {
        return Result.success(danmoMarketSealService.updateDanmoMarketSeal(danmoMarketSeal));
    }

    /**
     * 删除书画市场印章
     */
//    @RequiresPermissions("system:DanmoMarketSeal:remove")
    @Log(title = "书画市场印章", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids)
    {
        return Result.success(danmoMarketSealService.deleteDanmoMarketSealByIds(ids));
    }

    /**
     * 根据书画市场商品ID查询印章信息
     */
//    @RequiresPermissions("system:DanmoMarketSeal:list")
    @PostMapping("/lists")
    public Result lists(DanmoMarketSeal danmoMarketSeal)
    {
        List<DanmoMarketSeal> list = danmoMarketSealService.selectDanmoMarketSealLists(danmoMarketSeal);
        return Result.success(list);
    }
}
